<template>
  <div class="Details1">
    <NavBar fixed placeholder title="整改详情" z-index="999" ref="nav">
      <template #left>
        <Icon
          name="arrow-left"
          size="0.53rem"
          color="#000"
          @click="$router.back()"
        />
      </template>
    </NavBar>
    <div style="position: relative">
      <img class="bg-img" src="../../../assets/img/card.png" alt="" />
      <img class="bg-img2" src="../../../assets/img/deal.png" alt="" />
      <div class="header">
        <div class="state">任务状态 - {{ info.state }}</div>
        <div class="id">报修编号：{{ info.rrpId }}</div>
      </div>
      <div class="main">
        <div class="card">
          <Cell title="隐患描述" />
          <textarea
            v-model="info.remark"
            cols="30"
            rows="10"
            readonly
          ></textarea>
          <Cell title="隐患来源" :value="info.sourceType"></Cell>
          <Cell title="隐患类别" :value="info.causeType"></Cell>
          <Cell title="问题位置" :value="info.area"></Cell>
          <Cell title="发现人" :value="info.findUser"></Cell>
          <Cell title="发现时间" :value="info.findTime"></Cell>
          <p class="phone-text">照片</p>
          <VanImage
            src="https://img01.yzcdn.cn/vant/cat.jpeg"
            width="150"
            height="150"
            class="images"
          >
          </VanImage>
          <Cell title="整改建议" />
          <textarea
            v-model="info.resolveSuggest"
            cols="30"
            rows="10"
            readonly
          ></textarea>
          <Cell title="整改责任部门" :value="info.resolveDepart" />
          <Cell title="整改责任人" :value="info.resolveUser" />
          <div v-if="info.state !== '待整改'">
            <div class="item-title">任务信息</div>
            <Cell title="整改截止时间" :value="info.resolveEndTime" />
            <Cell title="整改人" :value="info.executor" />
            <div class="item-title">整改信息</div>
            <Cell title="完成情况" :value="info.finishType" />
            <Cell title="实际完成时间" :value="info.finishTime" />
            <Cell title="整改措施" />
            <textarea
              v-model="info.finishContent"
              cols="30"
              rows="10"
              readonly
            ></textarea>
            <p class="phone-text">照片</p>
            <VanImage
              src="https://img01.yzcdn.cn/vant/cat.jpeg"
              width="150"
              height="150"
              class="images"
            >
            </VanImage>
          </div>
          <div v-if="info.state == '已完成'">
            <div class="item-title">验收情况</div>
            <Cell title="验收情况" :value="info.checkFinishType" />
            <Cell title="验收时间" :value="info.checkFinishTime" />
            <Cell title="验收意见" />
            <textarea
              v-model="info.checkFinishContent"
              cols="30"
              rows="10"
              readonly
            ></textarea>
          </div>
        </div>
      </div>
    </div>
    <!-- <div class="drag" @click="toJump">
      <Icon name="todo-list-o" size="40"></Icon>
      <span>查看流程</span>
    </div> -->
    <div class="btn-placeholder" v-if="info.state !== '已完成'"></div>
    <!-- <Button
      class="btn"
      @click="toJump2"
      v-if="info.state == '待整改' || info.state == '存在疑异'"
    >
      任务分配
    </Button>
    <div class="btn-list" v-if="info.state == '待验收'">
      <Button class="btn-item" @click="toJump2"> 存在疑异 </Button>
      <Button class="btn-item" @click="toJump2"> 验收不通过 </Button>
      <Button class="btn-item" @click="toJump2"> 验收通过 </Button>
    </div> -->
    <div class="btn-list">
      <Button
        class="btn-item"
        @click="toJump2(item)"
        v-for="(item, i) in btnList"
        :key="i"
      >
        {{ item.oprName }}</Button
      >
    </div>

    <SideBtn
      :to="{
        name: 'WorkflowSteps',
        params: {
          workflowId: 'rskmgRecordResolve',
          pkValue: $route.query.rrpNo,
        },
      }"
    />
  </div>
</template>

<script>
import {
  rectificationDetails,
  rectificationDetailsBtn,
  rectificationDetailsBtnPost,
} from "../../../api/work";
import SideBtn from "components/SideBtn";
import {
  Image as VanImage,
  Uploader,
  Popup,
  NavBar,
  Icon,
  Field,
  Cell,
  List,
  Button,
} from "vant";
export default {
  props: {},
  data() {
    return {
      info: {},
      btnList: [],
    };
  },
  computed: {},
  created() {},
  mounted() {
    this.getInfo();
    this.getBtn();
  },
  watch: {},
  methods: {
    async getInfo() {
      const { param } = await rectificationDetails({
        rrpNo: this.$route.query.rrpNo,
        orgNo: localStorage.getItem("orgNo"),
      });
      // console.log(param.data);
      this.info = param.data;
    },
    async getBtn() {
      const { param } = await rectificationDetailsBtn({
        rrrNo: this.$route.query.rrrNo,
        orgNo: localStorage.getItem("orgNo"),
      });
      console.log(param.data);
      // this.btnList = param.data;
    },
    toJump() {
      this.$router.push("SnapshotSteps");
    },
    async toJump2(item) {
      await rectificationDetailsBtnPost({
        ...item,
      });
      this.$router.back();
    },
  },
  components: {
    SideBtn,
    VanImage,
    Uploader,
    Button,
    Popup,
    NavBar,
    Icon,
    Field,
    Cell,
    List,
  },
};
</script>

<style scoped lang="less">
@import "~@/style/var.less";
.Details1 {
  background-color: #f8f8f8;
  .flex {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  background-color: #f7f7f9;
  // /deep/.van-nav-bar__content {
  //   background-color: #3982f6;

  //   .van-nav-bar__title {
  //     color: #fff;
  //   }
  // }
  .bg-img {
    width: 100%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  .bg-img2 {
    z-index: 99;
    width: 200px;
    height: 200px;
    position: absolute;
    right: 24px;
    top: 150px;
  }
  .header {
    width: 100%;
    height: 190px;
    // background-color: red;
    display: flex;
    flex-flow: column;
    justify-content: center;
    padding-left: 20px;
    color: #edf0f5;
    .state {
      z-index: 99;
      font-size: 48px;
    }
    .id {
      z-index: 99;
      font-size: 26px;
    }
  }
  .main {
    position: relative;
    padding: 0 15px;
    .card {
      width: 100%;
      overflow: hidden;
      background-color: #fff;
      padding-bottom: 30px;
    }
  }
  .phone-text {
    font-size: 28px;
    padding: 20px;
    padding-left: 30px;
  }
  .images {
    margin-left: 25px;
  }
  .drag {
    position: fixed;
    bottom: 200px;
    right: 20px;
    padding: 10px;
    border-radius: 12px;
    background-color: #c6a86f;
    color: #fff;
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    span {
      margin-left: 7px;
    }
  }
  textarea {
    width: 90%;
    height: 157px;
    margin: 10px 0;
    margin-left: 50%;
    padding: 15px;
    transform: translate(-50%);
    border: 1px solid #dddddd;
    font-size: 26px;
    border-radius: 6px;
  }
  .btn-placeholder {
    height: 118px;
  }
  .btn {
    height: 98px;
    position: fixed;
    bottom: 10px;
    left: 50%;
    width: 90%;
    transform: translate(-50%);
    background: #fff;
    border-radius: 6px;
    font-weight: 500;
    color: @primary;
    border: 1px solid @primary;
    font-size: 36px;
  }
  .btn-list {
    height: 98px;
    position: fixed;
    bottom: 10px;
    left: 50%;
    width: 100%;
    transform: translate(-50%);
    font-size: 36px;
    font-weight: 500;
    display: flex;
    justify-content: space-around;
    .btn-item {
      // width: 30%;
      flex: 1;
      margin: 0 20px;
      height: 100%;
      border: 1px solid @primary;
      border-radius: 6px;
      color: @primary;
    }
  }
  .item-title {
    height: 70px;
    background-color: @primary;
    font-size: 30px;
    display: flex;
    align-items: center;
    color: #fff;
    opacity: 0.8;
    padding-left: 20px;
  }
}
</style>
